/**
 * 用户信息相关接口
 */
import type { CommonResult } from '@/api/common/types';
import type { UserState } from '@/store/modules/user/types';
import { get, post } from '@/utils/request';
import type { LoginByCodeParams, LoginByCodeResult, ProfileParams } from './types';

enum URL {
  login = '/user/login',
  loginByCode = '/user/loginByCode',
  logout = '/user/logout',
  profile = '/user/profile',
}

export const getUserProfile = (params?: ProfileParams) => get<UserState>({ url: URL.profile, params });
// export const login = (data: LoginParams) => post<LoginResult>({ url: URL.login, data });



// 登录
export const login = (data: any) => post({ url: '/ma/auth/v1/login', data });
// 扫码查询是否有次卡
export const postPackageFlag = (data: any) => post({ url: '/ma/home/v1/card/package/flag', data });
// 查询购买的次卡套餐
export const postPackagePage = (data: any) => post({ url: '/ma/home/v1/card/package/page', data });
// 购买次卡套餐
export const postBuyPackage = (data: any) => post({ url: '/ma/home/v1/buy/card/package', data });
// 创建洗头订单
export const postCreateOrder = (data: any) => post({ url: '/ma/home/v1/create/order', data });
// 订单详情
export const postOrderDetail = (data: any) => post({ url: '/ma/home/v1/order/detail', data });
// 查询用户信息
export const postPersonInfo = (data: any) => post({ url: '/ma/user/v1/person/info', data });
// 更新用户信息
export const postUpdateUserInfo = (data: any) => post({ url: '/ma/user/v1/update/info', data });
// 查询用户次卡套餐统计
export const postPackageCount = (data: any) => post({ url: '/ma/user/v1/card/package/count', data });
// 查询用户次卡
export const postUserPackagePage = (data: any) => post({ url: '/ma/user/v1/card/package/page', data });
// 查询订单列表
export const postUserOrderPage = (data: any) => post({ url: '/ma/user/v1/order/page', data });

// base64上传文件
export const postFileByBase64 = (data: any) => post({ url: '/sys/file/v1/base64/upload', data }); 


export const loginByCode = (data: LoginByCodeParams) => post<LoginByCodeResult>({ url: URL.loginByCode, data });
export const logout = () => post<CommonResult>({ url: URL.logout });
